package cn.tedu.charging.order.rabbitmq;


import cn.tedu.charging.order.config.RabbitMQConfig;
import cn.tedu.charging.order.pojo.po.RabbitmqDeadPo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Slf4j
@Component
public class RabbitMQProducter {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    public void sendMsg(RabbitmqDeadPo rabbitmqDeadPo){

        CorrelationData correlationData = new CorrelationData();
        correlationData.setId(rabbitmqDeadPo.getOrderNo());
        rabbitTemplate.convertAndSend(RabbitMQConfig.EXCHANGE_NAME,RabbitMQConfig.ROUTING_KEY,rabbitmqDeadPo,correlationData);
    }

}
